{% extends "admin/base_site.html" %}
{% load i18n %}

{% block breadcrumbs %}
<div id="breadcrumbs"> 
 <a href="/admin"> Home </a> 
 &rsaquo; 
 <a href="/admin/engrade_sync/"> Engrade Sync </a> 
 &rsaquo; 
 Setup
</div> 
{% endblock %}

{% block content %}    
    <h2> Engrade Sync Setup </h2>
    Courses synced: {{ course_count }} <br/>
    Teachers synced: {{ teacher_count }} <br/>
    Engrade School ID: {{ school_id }} <br/>
    Engrade API status: {% if engrade_sync %} Online {% else %} Offline! Either Engrade is down or something is broken! {% endif %} <br/>
    {% if msg %}
        <br/><br/>
        {{ msg }}
        <br/><br/>
    {% endif %}
    <form action="" method="post" style="width:850px;">
        <fieldset style="padding: 10px;">
            <legend>Generate Courses in Engrade for Marking Period</legend>
            Be careful, this cannot be undone without manually deleting Engrade courses.<br/>
            {{ course_form }} <br/>
            <input type="submit" name="generate_course" value="Generate Courses"/>
        </fieldset>
        <br/>
		<fieldset style="padding: 10px;">
            <legend>Generate All Teacher's Engrade Accounts</legend>
            Requires teacher exists in Faculty and have email set.<br/>
            <input type="submit" name="generate_teacher" value="Generate Teachers"/>
        </fieldset>
        <br/>
	<fieldset style="padding: 10px;">
            <legend>Generate All Student's Engrade Accounts</legend>
            Will send an email to students, you should run this about once per year. Student's email highly recommended. Will only create accounts for students<br/>
            <input type="submit" name="generate_student" disabled="disabled" value="Generate Students"/>
        </fieldset>
        <br/>
        <fieldset style="padding: 10px;">
            <legend>Sync Teacher Grades with Engrade</legend>
            Sync selected teacher grades from Engrade to SWoRD. Will overwrite current SWoRD grades.<br/>
            {{ grade_sync_form.as_p }}
            <input type="submit" name="grade_sync" value="Sync Grades"/>
        </fieldset>
    </form>
{% endblock %}